package lp.polimi.treefinder.utils;



import java.io.Serializable;
import java.util.HashMap;

/**
 * Generic message used by a client and the server to pass each other session informations.
 * Currently it's just used by the client to initiate the tagging procedure and by the server to
 * send back the final ranking.
 */
public class ManagingMessage implements PropertiesMap, Serializable {

	private static final long serialVersionUID = -7782279038118794776L;


	public ManagingMessage (Type type) {
		this.type = type;
	}

	private Type type;
	private HashMap<String, Object> properties = new HashMap<String, Object>();


	public Type getType () {
		return type;
	}

	@Override
	public void putProperty (String propertyName, Object value) {
		properties.put(propertyName, value);
	}


	@Override
	public Object getProperty (String propertyName) {
		return properties.get(propertyName);
	}


	@Override
	public void purgeProperty (String propertyName) {
		properties.remove(propertyName);
	}

	public enum Type {
		MATCHING_REQUEST, RANKING, ERROR
	}


}
